
<?php include_once 'common/header.php';  ?>
<?php 
$sex = $v['sex'];
$statusArr = $v['statusArr'];
$cardType = $v['cardType'];
?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once 'common/user_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>客户管理</strong> &gt;&gt;  编辑用户
		</div>
		<div class="admin_right_info">
			<form id="myform">
			<!-- <div class="admin_right_info_title"><h2>用户基础信息</h2></div> -->
			<input type="hidden" name="act" value="edit"/>
			<ul>
			<li>用户编辑</li>
			<li>用户ID：<?php echo $info['user_id']; ?></li>
			<li>用户名：<?php echo $info['username']; ?></li>
			<li>邮箱：<input type="text" name="email" id="email" value="<?php echo $info['email'];?>"/> </li>
			<li>登陆密码：<input type="password" name="password" id="password"/> </li>
			<li>确认密码：<input type="password" name="password2" id="password2" /> </li>
			
			<li>客户类型：
				<select name="type_id">
					<option value="2" <?php if ($info['type_id']==2) echo "selected='selected'"; ?>>普通客户</option>
					<option value="3" <?php if ($info['type_id']==3) echo "selected='selected'"; ?>>客服</option>
				</select> 
			</li>
			<li>是否内部账户：
				<input type="radio" name="is_self" value="0" <?php if ($info['is_self']==0) echo "checked='checked'"; ?>/>否  
				<input type="radio" name="is_self" value="1" <?php if ($info['is_self']==1) echo "checked='checked'"; ?>/>是
			</li>
			<li>状态：
				<input type="radio" name="fstatus" value="0" <?php if ($info['fstatus']==0) echo "checked='checked'"; ?>/>关闭  
				<input type="radio" name="fstatus" value="1" <?php if ($info['fstatus']==1) echo "checked='checked'"; ?>/>开通
				<input type="radio" name="fstatus" value="3" <?php if ($info['fstatus']==3) echo "checked='checked'"; ?>/>注销
				<input type="radio" name="fstatus" value="4" <?php if ($info['fstatus']==4) echo "checked='checked'"; ?>/>冻结
			</li>
			
			<li>真实姓名：<input type="text" name="realname" id="realname" value="<?php echo $info['realname'];?>"/> </li>
			<li>性别：
				<input type="radio" name="sex" value="1" <?php if ($info['sex']==1) echo "checked='checked'"; ?>/>男  
				<input type="radio" name="sex" value="2" <?php if ($info['sex']==2) echo "checked='checked'"; ?>/>女
			</li>
			<li>生日：<input type="text" name="birthday" id="birthday" onfocus="WdatePicker()" value="<?php echo $info['birthday'] ? date('Y-m-d',$info['birthday']) : '';?>" readonly="readonly"/> </li>
			<li>
                民族：
                <select class="pubinput" id="nation" name="nation">
                    <?php foreach ($minzu as $key => $val) {?>
                        <option value="<?php echo $key;?>" <?php if($info['nation']==$key) echo "selected='selected'"; ?>><?php echo $val;?></option>
                    <?php }?>
                </select>
            </li>
            <li>
                籍贯：
                <select class="pubinput" id="province" name="province" onchange="getChild(this.value,'','city');"><option value="">请选择</option></select>
                <select class="pubinput" style="width:120px;" id="city" name="city" onchange="getChild(this.value,'','area');"><option value="">请选择</option></select>
                <select class="pubinput" style="width:120px;" id="area" name="area"><option value="">请选择</option></select>
            </li>
			<li>证件类型：
				<select name="card_type">
				<?php foreach ($cardType as $k=>$v){?>
					
					<option value="<?php echo $k;?>" <?php if ($info['card_type']==$k) echo "selected='selected'"; ?>><?php echo $v;?></option>
				<?php }?>
				</select> 
				<input type="text" name="card_id" id="card_id" value="<?php echo $info['card_id'];?>"/>
			</li>

			<li>实名认证：
			<input type="radio" name="real_status" value="0" <?php if ($info['real_status']==0) echo "checked='checked'"; ?>/>不通过 
			<input type="radio" name="real_status" value="1" <?php if ($info['real_status']==1) echo "checked='checked'"; ?>/>认证通过 
			<input type="radio" name="real_status" value="2" <?php if ($info['real_status']==2) echo "checked='checked'"; ?>/>待审核</li>
                <li>邮箱认证：
                    <input type="radio" name="email_status" value="0" <?php if ($info['email_status']==0) echo "checked='checked'"; ?>/>不通过
                    <input type="radio" name="email_status" value="1" <?php if ($info['email_status']==1) echo "checked='checked'"; ?>/>认证通过
                    <input type="radio" name="email_status" value="2" <?php if ($info['email_status']==2) echo "checked='checked'"; ?>/>待审核
                </li>

			<li>手机：<input type="text" name="phone" id="phone" value="<?php echo $info['phone'];?>"/> </li>
			<li>手机认证：
			<input type="radio" name="phone_status" value="0" <?php if ($info['phone_status']==0) echo "checked='checked'"; ?>/>不通过 
			<input type="radio" name="phone_status" value="1" <?php if ($info['phone_status']==1) echo "checked='checked'"; ?>/>认证通过 
			<input type="radio" name="phone_status" value="2" <?php if ($info['phone_status']==2) echo "checked='checked'"; ?>/>待审核</li>

			<li>QQ：<input type="text" name="qq" id="qq" value="<?php echo $info['qq'];?>"/> </li>
			<li>登陆错误次数：<input type="text" name="error_num" id="error_num" value="<?php echo $info['error_num'];?>"/>（错误5次锁定登陆，解锁把次数改为0） </li>
			<li><input type="button" value="确认修改" onclick="toSubmit()"/></li>
			</ul>
			</form>
<script>
    function toSubmit(){
        var options = {
            url : '',
            dataType: "json",
            type:"post",
            success : function(ret) {
                $('#dialog').dialog({
                    modal:true,
                    title:'系统提示',
                    buttons:{"确定":function(){$(this).dialog("close");}},
                    close: function() {
                        location=ret.url;
                    }
                });
                $("#msg").html(ret.msg);
            }
        };
        $("#myform").ajaxSubmit(options);
        return false;
    }
    //籍贯选项--start
    $(document).ready(function(){
        getChild(0,'<?php echo isset($info['province'])?$info['province']:''; ?>','province');
        <?php if(isset($info['city']) && $info['city']){ ?>
        getChild('<?php echo $info['province']; ?>','<?php echo $info['city']; ?>','city');
        <?php } ?>

        <?php if(isset($info['area']) && $info['area']){ ?>
        getChild('<?php echo $info['city']; ?>','<?php echo $info['area']; ?>','area');
        <?php } ?>
    });

    function getChild(pid, selected,obj){
        $.ajax({
            type: "POST",
            url: "/area/get_option",
            data: "pid="+pid+"&selected="+selected,
            success: function(msg){
                $("#"+obj).html(msg);
            },
            dataType: "text"
        });
    }
    //籍贯选项--end
</script>			
			
			
		</div>
			
			
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<div id="dialog" style="display:none">
<p id="msg" style="text-align:center"></p>
</div>
</body>
</html>
